<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
    <title>编辑文章</title>
    <style type="text/css">
		.checkbox{
			 margin-left:5px;
			 width:90px;
			 margin-top: 10px;
		}
		textarea{
			width: 300px;
			height: 100px;
		}
    </style>
    <link rel="stylesheet" type="text/css" href="http://localhost/cms_edu/Static/hdjs/hdjs.css"/>
    <script type="text/javascript" charset="utf-8" src="http://localhost/cms_edu/Static/ueditor1_4_3/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="http://localhost/cms_edu/Static/ueditor1_4_3/ueditor.all.min.js"> </script>
    <script type="text/javascript" charset="utf-8" src="http://localhost/cms_edu/Static/ueditor1_4_3/lang/zh-cn/zh-cn.js"></script>
    <script src="http://localhost/cms_edu/Static/Js/jquery-1.7.2.min.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
    	$(function(){
    		$('.close-img').click(function(){
    			//清空图片和关闭按钮 显示input file表单
    			$('.thumb-td').html('<input type="file" name="thumb" id="" />');
    			
    		})
    	})
    </script>
</head>
<body>
<div class="wrap">
    <div class="hd-title-header">编辑文章</div>
    <form action="" method="post" class="form-inline hd-form" enctype="multipart/form-data">
        <table class="hd-table hd-table-list">
            <tr>
                <th class="w100">文章标题</th>
                <td class="w100">
                    <input type="text" name="title" class="w200" value="<?php echo $oldData['title'];?>"/> 
                </td>
                <td></td>
            </tr>
            <tr>
                <th class="w100">作者</th>
                <td>
                    <input type="text" name="author" class="w200" value="<?php echo $oldData['author'];?>"/>
                </td>
                <td></td>
            </tr>
            <tr>
                <th class="w100">所属分类</th>
                <td>
                    <select name="category_cid" class="w200">
                    	<option value="0">请选择分类</option>
                    	<?php foreach ($cateData as $k=>$v){?>
                    		<option value="<?php echo $v['cid'];?>"     <?php if($oldData['category_cid']==$v['cid']){ ?>selected<?php } ?>><?php echo $v['_name'];?></option>
                    	<?php }?>
                    </select>
                </td>
                <td></td>
            </tr>
            <tr>
                <th class="w100">文章摘要</th>
                <td>
                	<textarea name="digest" rows="" cols=""><?php echo $oldData['digest'];?></textarea>
                </td>
                <td></td>
            </tr>
            <tr>
                <th class="w100">缩略图</th>
                <td class="thumb-td">
                	    <?php if($oldData['thumb']){ ?>
                		<img src="http://localhost/cms_edu/<?php echo $oldData['thumb'];?>" style="width: 150px;height: 150px;"/>
						<a href="javascript:;" style="color: red;" class="close-img">X</a>
                	<?php }else{ ?>
                		<input type="file" name="thumb" id="" /> 
                	<?php } ?>
                </td>
                <td></td>
            </tr>
            <tr>
                <th class="w100">文章属性</th>
                <td>
                	<label class="checkbox-inline">
						热门
						<input type="checkbox" value="热门" name="attr[]" class="check_input"      <?php if(in_array('热门',$oldAttr)){ ?>checked<?php } ?> >
					</label>
					<label class="checkbox-inline">
						置顶
						<input type="checkbox" value="置顶" name="attr[]" class="check_input"     <?php if(in_array('置顶',$oldAttr)){ ?>checked<?php } ?>>
					</label>
					<label class="checkbox-inline">
						推荐
						<input type="checkbox" value="推荐" name="attr[]" class="check_input"      <?php if(in_array('推荐',$oldAttr)){ ?>checked<?php } ?> >
					</label>
					<label class="checkbox-inline">
						图文
						<input type="checkbox" value="图文" name="attr[]" class="check_input"     <?php if(in_array('图文',$oldAttr)){ ?>checked<?php } ?>>
					</label>
                </td>
                <td></td>
            </tr>
            <tr>
                <th class="w100">文章标签</th>
                <td>
                	<?php foreach ($tagData as $k=>$v){?>
                		<?php echo $v['tagname'];?> <input type="checkbox" name="tagname[]" id="" value="<?php echo $v['tid'];?>"     <?php if(in_array($v['tid'],$tagId)){ ?>checked<?php } ?> />
                	<?php }?>
                </td>
                <td></td>
            </tr>
             <tr>
                <th class="w100">文章关键字</th>
                <td>
                    <textarea name="keywords" id="" rows="10"><?php echo $oldData['keywords'];?></textarea>
                </td>
                <td></td>
            </tr>
             <tr>
                <th class="w100">文章描述</th>
                <td>
                    <textarea name="description" id="" cols="30" rows="10"><?php echo $oldData['description'];?></textarea>
                </td>
                <td></td>
            </tr>
             <tr>
                <th class="w100">文章正文</th>
                <td>
                    <script id="ed" type="text/plain" style="width:600px;height:300px;" name="content"><?php echo $oldData['content'];?></script>
                    <script>
						var ue = UE.getEditor('ed');
					</script>
                </td>
                <td></td>
            </tr>
        
        </table>
        <div class="position-bottom">
        	<input type="hidden" name="aid" value="<?php echo $hd['get']['aid'];?>"/>
            <input type="submit" class="hd-btn hd-btn-success" value="修改"/>
        </div>
    </form>
</div>
</body>
</html>